#include "clist.h"
#include "page.h"

/* replace_page */
int replace_page(CListElmt **current) {
	/* Circle through the list of page until one is found to replace. */
	while((0 != Page *)(*current)->data)->reference) {
		((Page *)(*current)->data)->reference = 0);
		*current = clist_next(*current);
	}

	return ((Page *)(*current)->data)->number;
}
